import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
export const routes = [
  {
    path: "/",
    redirect: "/login"
  },
  {
    path: '/home',
    name: 'home',
    meta: {
      name: "首页"
    },
    component: HomeView,
    children: [
      {
        path: "welcome",
        name: "welcome",
        label: "欢迎页面",
        meta: {
          name: "欢迎页面"
        },
        component: () => import('../views/welcome.vue'),
      },
      {
        path: "user",
        name: "user",
        label: "用户管理",
        meta: {
          name: "用户管理"
        },
        component: () => import('../views/user/userview.vue'),
        children: [
          {
            path: "index",
            name: "inde",
            label: "用户列表",
            meta: {
              name: "用户列表"
            },
            component: () => import('../views/user/userlist.vue'),
          }
        ]
      },
      {
        path: "cinema",
        name: "cinema",
        label: "影院管理",
        meta: {
          name: "影院管理"
        },
        component: () => import('../views/cinema/cinemaview.vue'),
        children: [
          {
            path: "index",
            name: "index",
            label: "影院列表",
            meta: {
              name: "影院列表"
            },
            component: () => import('../views/cinema/cinemalist.vue'),
          }
        ]
      },
      {
        path: "film",
        name: "film",
        label: "电影管理",
        meta: {
          name: "电影管理"
        },
        component: () => import('../views/film/filmview.vue'),
        children: [
          {
            path: "index",
            name: "ndex",
            label: "电影列表",
            meta: {
              name: "电影列表"
            },
            component: () => import('../views/film/filmlist.vue'),
          }
        ]
      }
    ]
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (About.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue')
  }
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
